package com.wasion.pwportable.protocol.p2;

/**
 * 
 * @ClassName: ExecutCmdRspEnum
 * @Description: 执行命令返回状态的枚举
 * @author 高意
 * @date Apr 14, 2016 2:15:53 PM
 * 
 */
public enum ExecutCmdRspEnum {

	EXECUT_RSP_SUCC("执行成功-无返回数据", 0), //
	EXECUT_RSP_FAIL("执行失败", 1), //
	EXECUT_RSP_REFUSE("拒绝访问", 2), //
	EXECUT_RSP_DATA("执行成功-有返回数据", 3), //
	EXECUT_RSP_UNEXPECT("执行异常-无返回数据", 4), //
	EXECUT_RSP_UNEXPECT_DATA("执行异常-有返回数据", 5), //
	ExecutCmdRsp_BUTT("返回结果错误或无相关流程", 6);//

	// 成员变量，枚举名称(说明)和索引
	private String name;
	private int index;

	// 构造方法
	private ExecutCmdRspEnum(String name, int index) {
		this.name = name;
		this.index = index;
	}

	// 普通方法
	public static String getName(int index) {
		for (ExecutCmdRspEnum c : ExecutCmdRspEnum.values()) {
			if (c.getIndex() == index) {
				return c.name;
			}
		}
		return null;
	}

	// get set 方法
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}
}
